<%
import pymssql
class MSSQL:
    def __init__(self,host,user,pwd,db):
        self.host = host
        self.user = user
        self.pwd = pwd
        self.db = db

    def __GetConnect(self):
        if not self.db:
            Response.write(NameError,"No connec Info")
        self.conn = pymssql.connect(host=self.host,user=self.user,password=self.pwd,database=self.db,charset="utf8")
        cur = self.conn.cursor()
        if not cur:
            Response.write(NameError,"connect Err")
        else:
            return cur
    def getCur(self):
        return self.__GetConnect()
    def ExecQuery(self,sql):
        cur = self.__GetConnect()
        cur.execute(sql)
        resList = cur.fetchall()
        self.conn.close()
        return resList

    def ExecNonQuery(self,sql):
        cur = self.__GetConnect()
        cur.execute(sql)
        self.conn.commit()
        self.conn.close()
gmssql = MSSQL(host="116.246.3.61\SQL2008,1738",user="sql_90002",pwd="Pur5.Com",db="db_90002")
#gcur = MSSQL.getCur()
%>
